#include "../../include/car_parts/binocularcamera.h"

BinocularCamera::BinocularCamera()
{
    this->model = "RealSense D435i";
    this->camera = "D430";
    this->rgbResolutionX = 1920;
    this->rgbResolutionY = 1080;
    this->rgbFrameRate = 30;
    this->fovX = 87;
    this->fovY = 58;
    this->depthFrameRate = 90;
}

void BinocularCamera::setModel(const std::string &model)
{
    this->model = model;
}

void BinocularCamera::setCamera(const std::string &camera)
{
    this->camera = camera;
}

void BinocularCamera::setRgbResolutionX(int rgbResolutionX)
{
    this->rgbResolutionX = rgbResolutionX;
}

void BinocularCamera::setRgbResolutionY(int rgbResolutionY)
{
    this->rgbResolutionY = rgbResolutionY;
}

void BinocularCamera::setRgbFrameRate(int rgbFrameRate)
{
    this->rgbFrameRate = rgbFrameRate;
}

void BinocularCamera::setFovX(int fovX)
{
    this->fovX = fovX;
}

void BinocularCamera::setFovY(int fovY)
{
    this->fovY = fovY;
}

void BinocularCamera::setDepthFrameRate(int depthFrameRate)
{
    this->depthFrameRate = depthFrameRate;
}

// 屏幕输出
void BinocularCamera::print()
{
    std::cout << "**双目摄像头模块**"
              << "\n摄像头: " << camera << "\n深度帧率: " << depthFrameRate << "\nFOV-X: " << fovX << "\nFOV-Y: " << fovY
              << "\n双目摄像头型号: " << model << "\nRGB帧率: " << rgbFrameRate << "\nRGB帧分辨率-X:" << rgbResolutionX << "\nRGB帧分辨率-Y: " << rgbResolutionY << std::endl;
}
// 本地文件保存
void BinocularCamera::save(const std::string &filename)
{
    // 打开一个输出文件流
    std::ofstream file(filename, std::ios::app);
    if (!file.is_open())
    {
        std::cout << "未找到文件！" << std::endl;
        return;
    }

    file << "," << camera << "," << depthFrameRate << "," << fovX << "," << fovY
         << "," << model << "," << rgbFrameRate << "," << rgbResolutionX << "," << rgbResolutionY;

    // 关闭文件流
    file.close();
}